#include<iostream>
#include<cmath>
using namespace std;
class Point
{
    private:
        double x,y;
    public:
        Point(double _x,double _y):x(_x),y(_y){ }
        friend double Distance(Point &a, Point &b);
};
double Distance(Point &a, Point &b)
{
    return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
int main()
{
    int N;
    cin>>N;
    while(N--)
    {
        int a1,b1,a2,b2;
        cin>>a1>>b1>>a2>>b2;
        Point point1(a1,b1);
        Point point2(a2,b2);
        printf("%.0f\n",Distance(point1,point2));
    }
}